package v1

import (
	"ginblog/api/common"
	"ginblog/model"
	"ginblog/utils/errmsg"
	"github.com/gin-gonic/gin"
	"github.com/gin-gonic/gin/binding"
)

// UpdateUserInfo /更新用户信息
func UpdateUserInfo(c *gin.Context) {
	A := model.Admin{}
	_ = c.ShouldBindBodyWith(&A, binding.JSON)

	if A.UpdateInfo() {
		common.SuccessJson(c, errmsg.SUCCESS, []interface{}{})
		return
	}

	if A.GetCode() != 0 {
		common.FailJson(c, A.GetCode())
		return
	}
	common.FailJson(c, errmsg.UPDATE_INFO_FAIL)
}
